package com.portal.web;

import com.portal.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@RequestMapping("user")
@RestController
public class UserController {
    public static final String SSO_EXIT="HTTP://47.94.219.203/exit";
    @RequestMapping("find")
    public User getUser(HttpSession session)

    {
        User user2 = (User) session.getAttribute("user");
        return user2;
    }

    @RequestMapping("exit")
    public void exit(HttpServletResponse response) throws IOException {
        response.sendRedirect(SSO_EXIT);
    }
}
